#include "SQLUnionOperator.h"
#include "../../../utils/StringUtils.h"

SQLUnionOperator_ptr SQLUnionOperator::UNION = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 1, make_string_ptr("UNION")));
SQLUnionOperator_ptr SQLUnionOperator::UNION_ALL = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 2, make_string_ptr("UNION ALL")));
SQLUnionOperator_ptr SQLUnionOperator::MINUS = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 3, make_string_ptr("MINUS")));
SQLUnionOperator_ptr SQLUnionOperator::MINUS_DISTINCT = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 4, make_string_ptr("MINUS DISTINCT")));
SQLUnionOperator_ptr SQLUnionOperator::MINUS_ALL = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 5, make_string_ptr("MINUS ALL")));
SQLUnionOperator_ptr SQLUnionOperator::EXCEPT = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 6, make_string_ptr("EXCEPT")));
SQLUnionOperator_ptr SQLUnionOperator::EXCEPT_ALL = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 7, make_string_ptr("EXCEPT ALL")));
SQLUnionOperator_ptr SQLUnionOperator::EXCEPT_DISTINCT = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 8, make_string_ptr("EXCEPT DISTINCT")));
SQLUnionOperator_ptr SQLUnionOperator::INTERSECT = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 9, make_string_ptr("INTERSECT")));
SQLUnionOperator_ptr SQLUnionOperator::INTERSECT_ALL = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 10, make_string_ptr("INTERSECT ALL")));
SQLUnionOperator_ptr SQLUnionOperator::INTERSECT_DISTINCT = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 11, make_string_ptr("INTERSECT DISTINCT")));
SQLUnionOperator_ptr SQLUnionOperator::DISTINCT = SQLUnionOperator_ptr(new SQLUnionOperator(1 << 12, make_string_ptr("UNION DISTINCT")));

SQLUnionOperator::SQLUnionOperator(uint64_t mask, string_ptr name)
{
  this->mask = mask;
  this->name = name;
  this->nameLCase = StringUtils::toLower( name);
}

bool SQLUnionOperator::operator==(SQLUnionOperator &rgt)
{
  return name->c_str() == rgt.name->c_str() && mask == rgt.mask;
}

bool SQLUnionOperator::operator!=(SQLUnionOperator &rgt)
{
  return !(name->c_str() == rgt.name->c_str() && mask == rgt.mask);
}